Browse Source

fix formatter

Ivan Valkou 5 năm trước cách đây
mục cha
commit
90ae34da2e

+ 1 - 1
FreeAPS/Sources/Helpers/JSON.swift

@@ -34,12 +34,12 @@ extension Bool: JSON {}
 extension Date: JSON {
 extension Date: JSON {
     var string: String {
     var string: String {
         let formatter = ISO8601DateFormatter()
         let formatter = ISO8601DateFormatter()
-        formatter.formatOptions = [.withColonSeparatorInTimeZone]
         return formatter.string(from: self)
         return formatter.string(from: self)
     }
     }
 
 
     init?(from: String) {
     init?(from: String) {
         let dateFormatter = ISO8601DateFormatter()
         let dateFormatter = ISO8601DateFormatter()
+        dateFormatter.formatOptions.insert(.withFractionalSeconds)
         let string = from.replacingOccurrences(of: "\"", with: "")
         let string = from.replacingOccurrences(of: "\"", with: "")
         if let date = dateFormatter.date(from: string) {
         if let date = dateFormatter.date(from: string) {
             self = date
             self = date